

# 我是爸爸 我是娜娜


from rest_framework.generics import ListAPIView

from . import models, serializers
class BannerListAPIView(ListAPIView):
    queryset = models.Banner.objects.filter(is_delete=False, is_show=True).order_by('-order').all()
    serializer_class = serializers.BannerModelSerializer

    def get(self, request, *args, **kwargs):
        return self.list(request, *args, **kwargs)

def Test():
    ...


import os
def post(request,*args,**kwargs):
    return "request"

def mkdir_path(path):
    #获取绝对路径
    path = os.path.abspath(path)
    if not os.path.exists(path):
        mkdir_path(os.path.dirname(path))
        os.mkdir(path)


    from rest_framework.serializers import ModelSerializer
    from . import models
    class BannerModelSerializer(ModelSerializer):
        class Meta:
            model = models.Banner
            fields = ('title', 'link', 'image', 'info')

        


from rest_framework.serializers import ModelSerializer
from . import models
class BannerModelSerializer(ModelSerializer):
    class Meta:
        model = models.Banner
        fields = ('title', 'link', 'image', 'info')



